{{ template "head" . }}

{{ template "prom_right_table_head" }}
<tr>
  <th>SNMP</th>
  <th>{{ template "prom_query_drilldown" (args "sum(up{job='snmp'})") }} / {{ template "prom_query_drilldown" (args "count(up{job='snmp'})") }}</th>
</tr>
{{ template "prom_right_table_tail" }}

{{ template "prom_content_head" . }}
<h1>SNMP</h1>

<table class="table table-condensed table-striped table-bordered" style="width: 0%">
<tr>
  <th>Device</th>
  <th>Up</th>
  <th>Ports Up</th>
  <th>Ports Total</th>
  <th>In</th>
  <th>Out</th>
  <th>Discards</th>
  <th>Errors</th>
</tr>
{{ range query "up{job='snmp'}" | sortByLabel "instance" }}
<tr>
  <td><a href="snmp-overview.html?instance={{ .Labels.instance }}">{{ .Labels.instance }}</a></td>
  <td {{ if eq (. | value) 1.0 }}>Yes{{ else }} class="alert-danger">No{{ end }}</td>
  <td class="text-right">{{ query (printf "ifOperStatus{job='snmp',instance='%s'} == 1" .Labels.instance) | len }}</td>
  <td class="text-right">{{ template "prom_query_drilldown" (args (printf "count(ifOperStatus{job='snmp',instance='%s'})" .Labels.instance) ) }}</td>
  <td class="text-right">{{ template "prom_query_drilldown" (args (printf "8 * sum by (instance)(irate(ifHCInOctets{job='snmp',instance='%s'}[5m]) or irate(ifInOctets{job='snmp',instance='%s'}[5m]))" .Labels.instance .Labels.instance) "b/s" "humanize")}}</td>
  <td class="text-right">{{ template "prom_query_drilldown" (args (printf "8 * sum by (instance)(irate(ifHCOutOctets{job='snmp',instance='%s'}[5m]) or irate(ifOutOctets{job='snmp',instance='%s'}[5m]))" .Labels.instance .Labels.instance) "b/s" "humanize")}}</td>
  <td class="text-right">{{ template "prom_query_drilldown" (args (printf "8 * sum by (instance)(irate(ifInDiscards{job='snmp',instance='%s'}[5m]) or irate(ifOutDiscards{job='snmp',instance='%s'}[5m]))" .Labels.instance .Labels.instance) "/s" "humanizeNoSmallPrefix")}}</td>
  <td class="text-right">{{ template "prom_query_drilldown" (args (printf "8 * sum by (instance)(irate(ifInErrors{job='snmp',instance='%s'}[5m]) or irate(ifOutErrors{job='snmp',instance='%s'}[5m]))" .Labels.instance .Labels.instance) "/s" "humanizeNoSmallPrefix")}}</td>
</tr>
{{ else }}
<tr><td colspan=4>No devices found.</td></tr>
{{ end }}

{{ template "prom_content_tail" . }}

{{ template "tail" }}
